import 'package:json_annotation/json_annotation.dart';

part 'banner_data.g.dart';

@JsonSerializable()
class BannerData {
  final int errorCode;
  final String errorMsg;
  final List<BannerItemData> data;

  BannerData({
    required this.errorCode,
    required this.errorMsg,
    required this.data,
  });

  factory BannerData.fromJson(Map<String, dynamic> json) =>
      _$BannerDataFromJson(json);

  Map<String, dynamic> toJson() => _$BannerDataToJson(this);
}

@JsonSerializable()
class BannerItemData {
  final int id;
  final String title;
  final String desc;
  final String imagePath;
  final int isVisible;
  final int order;
  final int type;

  BannerItemData({
    required this.id,
    required this.title,
    required this.desc,
    required this.imagePath,
    required this.isVisible,
    required this.order,
    required this.type,
  });

  factory BannerItemData.fromJson(Map<String, dynamic> json) =>
      _$BannerItemDataFromJson(json);

  Map<String, dynamic> toJson() => _$BannerItemDataToJson(this);
}
